<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OrangeCNC - ARISC firmware documentation: io.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">OrangeCNC - ARISC firmware documentation
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('io_8h.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a>  </div>
  <div class="headertitle">
<div class="title">io.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;stdint.h&gt;</code><br />
</div>
<p><a href="io_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:aed54ef84775a6b4184dbc8a5cfdce6eb"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#aed54ef84775a6b4184dbc8a5cfdce6eb">readl</a>(addr)&#160;&#160;&#160;(*((volatile uint32_t *)(addr)))</td></tr>
<tr class="separator:aed54ef84775a6b4184dbc8a5cfdce6eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab90b1d3d9044f8445e52de3289a02342"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#ab90b1d3d9044f8445e52de3289a02342">writel</a>(v,  addr)&#160;&#160;&#160;(<a class="el" href="io_8h.html#aed54ef84775a6b4184dbc8a5cfdce6eb">readl</a>(addr) = (uint32_t)(v))</td></tr>
<tr class="separator:ab90b1d3d9044f8445e52de3289a02342"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa1092889a966f906260044e4291f4fce"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#aa1092889a966f906260044e4291f4fce">set_bit</a>(nr,  addr)&#160;&#160;&#160;(<a class="el" href="io_8h.html#aed54ef84775a6b4184dbc8a5cfdce6eb">readl</a>(addr) |=  (1u &lt;&lt; (nr)))</td></tr>
<tr class="separator:aa1092889a966f906260044e4291f4fce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adbf4e1afa46bb31a1287930b97daf0a7"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#adbf4e1afa46bb31a1287930b97daf0a7">clr_bit</a>(nr,  addr)&#160;&#160;&#160;(<a class="el" href="io_8h.html#aed54ef84775a6b4184dbc8a5cfdce6eb">readl</a>(addr) &amp;= ~(1u &lt;&lt; (nr)))</td></tr>
<tr class="separator:adbf4e1afa46bb31a1287930b97daf0a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4eaf4bf81c52c3f375967906e4d5ba17"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#a4eaf4bf81c52c3f375967906e4d5ba17">BIT</a>(nr)&#160;&#160;&#160;(1u &lt;&lt; (nr))</td></tr>
<tr class="separator:a4eaf4bf81c52c3f375967906e4d5ba17"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a58036ec108bbebb24caf8258cc569e36"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#a58036ec108bbebb24caf8258cc569e36">MASK</a>(nr)&#160;&#160;&#160;((1u &lt;&lt; (nr)) - 1)</td></tr>
<tr class="separator:a58036ec108bbebb24caf8258cc569e36"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad8da9194ea08031aae97a6e6ecc421d7"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#ad8da9194ea08031aae97a6e6ecc421d7">MASK_AT</a>(nr,  start)&#160;&#160;&#160;(<a class="el" href="io_8h.html#a58036ec108bbebb24caf8258cc569e36">MASK</a>(nr) &lt;&lt; (start))</td></tr>
<tr class="separator:ad8da9194ea08031aae97a6e6ecc421d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9924ce77c6ee520262d95cb9e0c91e75"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#a9924ce77c6ee520262d95cb9e0c91e75">GET_BITS_AT</a>(value,  nr,  start)&#160;&#160;&#160;(((value) &gt;&gt; start) &amp; <a class="el" href="io_8h.html#a58036ec108bbebb24caf8258cc569e36">MASK</a>(nr))</td></tr>
<tr class="separator:a9924ce77c6ee520262d95cb9e0c91e75"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ee4771e564336128cbd231b58ec81bd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8h.html#a8ee4771e564336128cbd231b58ec81bd">SET_BITS_AT</a>(value,  nr,  start,  bits)&#160;&#160;&#160;((value) &amp;= ~<a class="el" href="io_8h.html#ad8da9194ea08031aae97a6e6ecc421d7">MASK_AT</a>(nr, start), (value) |= ((bits) &amp; <a class="el" href="io_8h.html#a58036ec108bbebb24caf8258cc569e36">MASK</a>(nr)) &lt;&lt; start)</td></tr>
<tr class="separator:a8ee4771e564336128cbd231b58ec81bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="aed54ef84775a6b4184dbc8a5cfdce6eb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aed54ef84775a6b4184dbc8a5cfdce6eb">&#9670;&nbsp;</a></span>readl</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define readl</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">addr</td><td>)</td>
          <td>&#160;&#160;&#160;(*((volatile uint32_t *)(addr)))</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="ab90b1d3d9044f8445e52de3289a02342"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab90b1d3d9044f8445e52de3289a02342">&#9670;&nbsp;</a></span>writel</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define writel</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">v, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">addr&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(<a class="el" href="io_8h.html#aed54ef84775a6b4184dbc8a5cfdce6eb">readl</a>(addr) = (uint32_t)(v))</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="aa1092889a966f906260044e4291f4fce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa1092889a966f906260044e4291f4fce">&#9670;&nbsp;</a></span>set_bit</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define set_bit</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">nr, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">addr&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(<a class="el" href="io_8h.html#aed54ef84775a6b4184dbc8a5cfdce6eb">readl</a>(addr) |=  (1u &lt;&lt; (nr)))</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="adbf4e1afa46bb31a1287930b97daf0a7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adbf4e1afa46bb31a1287930b97daf0a7">&#9670;&nbsp;</a></span>clr_bit</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define clr_bit</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">nr, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">addr&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(<a class="el" href="io_8h.html#aed54ef84775a6b4184dbc8a5cfdce6eb">readl</a>(addr) &amp;= ~(1u &lt;&lt; (nr)))</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a4eaf4bf81c52c3f375967906e4d5ba17"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4eaf4bf81c52c3f375967906e4d5ba17">&#9670;&nbsp;</a></span>BIT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BIT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">nr</td><td>)</td>
          <td>&#160;&#160;&#160;(1u &lt;&lt; (nr))</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a58036ec108bbebb24caf8258cc569e36"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a58036ec108bbebb24caf8258cc569e36">&#9670;&nbsp;</a></span>MASK</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MASK</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">nr</td><td>)</td>
          <td>&#160;&#160;&#160;((1u &lt;&lt; (nr)) - 1)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="ad8da9194ea08031aae97a6e6ecc421d7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad8da9194ea08031aae97a6e6ecc421d7">&#9670;&nbsp;</a></span>MASK_AT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MASK_AT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">nr, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">start&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(<a class="el" href="io_8h.html#a58036ec108bbebb24caf8258cc569e36">MASK</a>(nr) &lt;&lt; (start))</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a9924ce77c6ee520262d95cb9e0c91e75"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9924ce77c6ee520262d95cb9e0c91e75">&#9670;&nbsp;</a></span>GET_BITS_AT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define GET_BITS_AT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">value, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">nr, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">start&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(((value) &gt;&gt; start) &amp; <a class="el" href="io_8h.html#a58036ec108bbebb24caf8258cc569e36">MASK</a>(nr))</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a8ee4771e564336128cbd231b58ec81bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ee4771e564336128cbd231b58ec81bd">&#9670;&nbsp;</a></span>SET_BITS_AT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define SET_BITS_AT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">value, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">nr, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">start, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">bits&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;((value) &amp;= ~<a class="el" href="io_8h.html#ad8da9194ea08031aae97a6e6ecc421d7">MASK_AT</a>(nr, start), (value) |= ((bits) &amp; <a class="el" href="io_8h.html#a58036ec108bbebb24caf8258cc569e36">MASK</a>(nr)) &lt;&lt; start)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="io_8h.html">io.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
